package dao;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import modelo.Cobro;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import util.HibernateUtil;

public class CobroDao implements Serializable {

	
	private static final long serialVersionUID = -761506296658957908L;
	private Session session;
	SessionFactory sessionFactory = HibernateUtil.getSessionFactory();

	public CobroDao() {
		super();
	}

	public void guardarCobro(Cobro cobro) {
		session = sessionFactory.openSession();
		session.beginTransaction();

		try {
			session.save(cobro);
			session.getTransaction().commit();

		} catch (Exception e) {
			session.getTransaction().rollback();
		} finally {
			session.close();
		}

	}

}
